#include <stdio.h>

int main(int argc, char const *argv[])
{
    int p1, p2, p3;
    char input[128], output[40960], *ip, *op;
    char left, right, k, i;
    int j;

    scanf("%d%d%d", &p1, &p2, &p3);
    scanf("%s", input);

    ip = input;
    op = output;
    while (*ip)
    {
        if (*ip == '-')
        {
            left = *(ip - 1);
            right = *(ip + 1);
            if (left + 1 == right)
            {
                ip++;
            }
            else if (((left >= '0' && left <= '9') && (right >= '0' && right <= '9'))
                || ((left >= 'a' && left <= 'z') && (right >= 'a' && right <= 'z')))
            {
                left++; 
                right--;

                if (left <= right)
                {
                    //逆序输出
                    if (p3 == 2)
                    {
                        k = right;
                        right = left;
                        left = k; 
                    }
                    
                    for (i = left; p3 == 2 ? i >= right : i <= right; p3 == 2 ? i-- : i++)
                    {
                        if (p1 == 3)
                        {
                            for (j = 0; j < p2; j++)
                            {
                                *op = '*';
                                op++;
                            }
                        }
                        else if (p1 == 1 || (left >= '0' && left <= '9'))
                        {
                            for (j = 0; j < p2; j++)
                            {
                                *op = i;
                                op++;
                            }
                        }
                        else
                        {
                            for (j = 0; j < p2; j++)
                            {
                                *op = i - ('a' - 'A');
                                op++;
                            }
                        }
                    }
                    ip++;
                }
            }
        }
        *op = *ip;
        op++;
        ip++;
    }
    *op = '\0';
    printf("%s", output);
    return 0;
}
